package eurekaClient.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import eurekaClient.myInterface.FeignInterface;

@RestController
public class FeignController {

	@Autowired
    private FeignInterface feign;

    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public Integer add(HttpServletRequest request) {
    	System.out.println(request.getSession().getId());
        return feign.add(10, 20);
    }
    
    @GetMapping(value = "/toJsp")
    public ModelAndView toJsp(HttpServletRequest request) {
        return feign.toJsp();
    }
    
    @RequestMapping("/hello/{name}")
    public String hello(@PathVariable("name") String name) {
    	return feign.hello(name);
    }
}
